package com.google.code.twiddling.core.command;

import com.google.code.twiddling.core.util.StringUtil;

/**
 * @author <a href="mailto:yy.young@gmail.com">Young Yang</a>
 */
public class CommandMetadata {

    private String cmdline;

    private String name;
    
    private String[] parameters;

    public CommandMetadata(String cmdline) {
        this.cmdline = cmdline;
        String[] cmds = StringUtil.getStringBySpaceDelimiter(cmdline);
        if (cmds != null && cmds.length > 0){
        	this.name = cmds[0];
        	parameters = new String[cmds.length - 1];
            for (int i = 0; i <= cmds.length - 2; i++) {
                parameters[i] = cmds[i + 1];
            }
        }        
    }

    public String getName() {
        return name;
    }

    public String getCmdline() {
        return cmdline;
    }

	public String[] getParameters() {
		return parameters;
	}

}
